|
STEP 7: A Gratuitous Scope
|
Just as in the Embedding a Mute Button example, we could also use the Beatnik Player to embed a gratuitous scope for our music preview table. The scope will give the user a colored lights show to entertain their eyes while their ears are immersed in the music.
Now, even though the music files are not playing through the player instance that we will use to embed the scope, our 'gratuitous' scope will display the audio output for any and all music files that are playing through Beatnik since the scope is a global resource that is shared by all instances of the Beatnik Player - Beatnik has one common output.
Try playing one (or more) of the files below and see how the seemingly unrelated scope instance comes alive with animated waveforms. Feel like a bit of fun? Turn on all the music files together and then watch the scope to see what a cacophony truly looks like.
| "Ambient" by Brian Salter | |
| "Classical" arranged by Brian Salter | |
| "Jungle" by Brian Salter | |
| "Lounge" by Brian Salter | |
| "Modern Rock" by Paul Sebastien |
Let's take a look at the source code for this example. The text that is highlighted indicates the code that is responsible for displaying our "gratuitous scope". The rest of the code is resposible for embedding the other player instances that appear inside the table layout in the form of slim transport controls.
<CENTER>
<TABLE BORDER=4 CELLSPACING=0 CELLPADDING=0>
<TR><TD><EMBED
SRC="stub.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=45
DISPLAY=SYSTEM
MODE=SCOPE
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
></TD></TR>
</TABLE>
<BR>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=6>
<TR BGCOLOR=EEEEEE>
<TD>
"<B>Ambient</B>" by Brian Salter
</TD>
<TD>
<EMBED
SRC="ambient.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=DDDDDD>
<TD>
"<B>Classical</B>" arranged by Brian Salter
</TD>
<TD>
<EMBED
SRC="classical.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=CCCCCC>
<TD>
"<B>Jungle</B>" by Brian Salter
</TD>
<TD>
<EMBED
SRC="jungle.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=BBBBBB>
<TD>
"<B>Lounge</B>" by Brian Salter
</TD>
<TD>
<EMBED
SRC="lounge.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
<TR BGCOLOR=AAAAAA>
<TD>
"<B>Modern Rock</B>" by Paul Sebastien
</TD>
<TD>
<EMBED
SRC="modern-rock.rmf"
TYPE="audio/rmf"
WIDTH=144
HEIGHT=15
DISPLAY=SONG
AUTOSTART=FALSE
LOOP=FALSE
PLUGINSPAGE="http://www.beatnik.com/to/?player"
>
</TD>
</TR>
</TABLE>
</CENTER>
|
By specifying a HEIGHT of 45, the Beatnik control panel knows to only display its lower portion. And because the player instance is embedded with the DISPLAY attribute set to SYSTEM and the MODE attribute set to SCOPE, the oscilloscope is what appears in this lower portion. Finally, to prevent our gratuitous scope instance from limiting the number of other player instances that can be playing files simultaneously, the instance is embedded with AUTOSTART set to FALSE so that it does not automatically start playing.